package com.example.taximeter.mapper;

import com.example.taximeter.bean.ParamFile;
import com.example.taximeter.bean.ParamFileLog;
import com.example.taximeter.bean.ParamFileLogView;
import com.example.taximeter.bean.ParamFileView;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 参数文件日志
 */
@Mapper
public interface ParamFileLogMapper {

    //添加参数文件管理日志
    @Insert("insert into tab_log_param_oper (param_id, user_name, oper_type, \n" +
            "      oper_content, oper_time)\n" +
            "    values (#{paramid,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{opertype,jdbcType=INTEGER}, \n" +
            "   #{opercontent,jdbcType=VARCHAR}, #{opertime,jdbcType=TIMESTAMP} )")
    boolean addParamfileLog(ParamFileLog paramFileLog);

    //查询参数文件列表
    @SelectProvider(type = ActivityMapperProvider.class, method = "findParamFileLogAll")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "paramid", column = "param_id"),
            @Result(property = "username", column = "user_name"),
            @Result(property = "opertype", column = "oper_type"),
            @Result(property = "opercontent", column = "oper_content"),
            @Result(property = "opertime", column = "oper_time"),
    })
    List<ParamFileLog> findParamFileLogAll(ParamFileLog paramFileLog);


    @Select("select * from tab_log_param_oper where id = #{id,jdbcType=INTEGER} ")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "paramid", column = "param_id"),
            @Result(property = "username", column = "user_name"),
            @Result(property = "opertype", column = "oper_type"),
            @Result(property = "opercontent", column = "oper_content"),
            @Result(property = "opertime", column = "oper_time"),
    })
    ParamFileLog findParamfilelog(@Param("id") Integer id);
}
